#!/usr/bin/enr/python3
# -*- coding: utf-8 -*-
# -------------------------------
# @Author : hurong
# @File : 06_func_params.py
# @Time : 2023/6/30 16:44
# -------------------------------

''' *args 可以接收任意多个实际参数，并将其放在一个元组当中
    使用已经存在的列表或元组作为函数的可变参数，可以在列表的名称前加*
'''
def print_language(*args):
    print(args)
    for i in args:
        print(i)


# # 调用函数，把不同梳理的参数传递进去,用位置参数
# print_language("python","java","C++")
# print_language("python","java","C++", "Go", "php")
lan = ["python","java","php"]
print(lan)  # ['python', 'java', 'php']
print(*lan) # python java php

'''**kwargs
接收任意多个类似关键字参数一样显示赋值的实际参数；
将其放到一个字典中
'''
def print_info(**kwargs):
    print(kwargs)

print_info(Tom =18, Lily=12)
print_info(Tom=18,lily=12,Ammy=16)

data = {
    "tom":18,
    "lily":21,
    "jim":20
}
print_info(**data)  # 输出结果：{'tom': 18, 'lily': 21, 'jim': 20}
